package com.zkt.subject.domain.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.*;

/**
 * @author 赵开泰
 * @program jc-club
 * @date 2025/2/26
 * @description 线程池的config管理
 **/

@Configuration
public class ThreadPoolConfig {
	
	@Bean(name = "labelThreadPool")
	public ThreadPoolExecutor getLabelThreadPool() {
		return new ThreadPoolExecutor(20, 100, 5,
				TimeUnit.SECONDS, new LinkedBlockingDeque<>(40),
				new CustomNameThreadFactory("label"),
				new ThreadPoolExecutor.CallerRunsPolicy());
	}
	
}
